﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Hopscotch.Domain.Common;
using Hopscotch.Domain.Enquiry;

namespace Hopscotch.Server.EnqServiceFake
{
    public abstract class FakeEnqServiceIntKey<T> : FakeEnqServiceBase<T, int>
        where T : IEnquiryEntity<int>
    {
        private static Dictionary<int, T> fakeData = new Dictionary<int, T>();

        protected IDictionary<int, T> FakeData
        {
            get
            {
                return fakeData;
            }
        }

        protected void Add(T entity)
        {
            fakeData.Add(entity.Id, entity);
        }

        public override T Get(int id)
        {
            T entity = default(T);
            fakeData.TryGetValue(id, out entity);

            return entity;
        }

    }
}
